import request from '../utils/request'

// 获取当前用户信息
export function getCurrentUser() {
    return request({
        url: '/auth/current',
        method: 'get'
    })
}

// 获取用户统计信息
export function getUserStats() {
    return request({
        url: '/users/stats',
        method: 'get'
    })
}

export const getUserInfo = (userId) => {
    return request({
        url: `/users/${userId}`,
        method: 'get'
    })
}

export const updateUserInfo = (data) => {
    return request({
        url: '/users/current',
        method: 'put',
        data: data
    })
}

export const updatePassword = (data) => {
    return request({
        url: '/users/current/password',
        method: 'put',
        data: data
    })
}

export const uploadAvatar = (file) => {
    const formData = new FormData()
    formData.append('file', file)
    return request({
        url: '/upload/image',
        method: 'post',
        data: formData,
        headers: {
            'Content-Type': 'multipart/form-data'
        }
    })
} 